package com.poorstu.dao.impl;

import java.util.List;

import com.common.base.dao.impl.BaseDaoImpl;
import com.poorstu.dao.AdminDao;
import com.poorstu.model.LeaseMod;
import com.poorstu.model.RoleMod;

public class AdminImpl extends BaseDaoImpl implements AdminDao{

	
	
	public void AddRole(RoleMod role) 
	{
		super.save(role);
	}

	//进入到修改角色页面 根据id 察出该id的所有信息
	public RoleMod changeRole(int roleid) {
		return (RoleMod)super.findById("RoleMod", roleid);
	}


	public int deleteRole(int roleid[]) {
		int a=0;
		for(int i=0;i<roleid.length;i++){
		 a=super.executeHQL("deleteRoleById", new Object[]{roleid[i]});
		}
		return  a;
		
	}

//  修改角色
	public void roleChged(RoleMod role) {
		
		super.saveOrUpdate(role);
	   // super.saveOrUpdate(role);		
	}

	
	//////////////////////公告管理/////////
	public void leaseAdd(LeaseMod lease) {
		super.save(lease);
	}

	public List<LeaseMod> leaseMag() {
		return super.findAll("LeaseMod");
	}

	public int leaseDelete(int[] leaseid) {
		int a=0;
		for(int i=0;i<leaseid.length;i++){
		 a=super.executeHQL("deleteLeaseById", new Object[]{leaseid[i]});
		}
		return  a;
	}
	 
public LeaseMod selLeaseById(int leaseId) {
		
		return (LeaseMod)super.findById("LeaseMod", leaseId);
	}

	public void changeLease(LeaseMod lease) {
		
		 super.saveOrUpdate("LeaseMod");
	}
	
	
	
	
}
